package day12.problem3;

import java.util.*;

//求一个字符串中某个子序列的个数
//https://ac.nowcoder.com/acm/problem/26226

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        String s = in.next();
        long[] dp = new long[4];
        String t = "shy";
        for(int i = 0; i<n; i++) {
            for(int j = 0; j<3; j++) {
                if(s.charAt(i) == t.charAt(j)) {
                    if(j == 0) dp[j]++;
                    else dp[j] += dp[j-1];
                }
            }
        }
        System.out.println(dp[2]);
    }
}

/*

dp[j]: shy的前j个字符出现的数量

*/